<template>
    <section>
        <el-col :span="24">
            <el-form inline>
                <el-form-item>
                    <el-select v-model="form.supplier_id" filterable remote placeholder="输入搜索的工厂名称" size="small"
                               :remote-method="searchFactoryBtn" :loading="searchLoading" clearable>
                        <el-option v-for="(item,index) in factoryList" :label="item.factory_name" :value="item.supplier_id" :key="index" ></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <el-input size="small" placeholder="加工单号" v-model.trim="form.processing_code" clearable></el-input>
                </el-form-item>
                <el-form-item>
                    <el-input size="small" placeholder="款号" v-model.trim="form.type_no" style="width: 150px;" clearable></el-input>
                </el-form-item>
                <el-form-item>
                    <el-select size="small" placeholder="审核状态" v-model="form.status" style="width: 120px" clearable>
                        <el-option :value=0 label="未提交"></el-option>
                        <el-option :value=1 label="审核中"></el-option>
                        <el-option :value=2 label="已通过"></el-option>
                        <el-option :value=3 label="已拒绝"></el-option>
                        <el-option :value=4 label="已撤销"></el-option>
                        <el-option :value=5 label="已撤回"></el-option>
                    </el-select>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" class="el-icon-search" @click="searchBtn" size="small" :loading="btnLoading">查询
                    </el-button>
                </el-form-item>
            </el-form>
        </el-col>
        <el-col :span="24">
            <el-table :data="data" style="width: 100%" :max-height="tableHeight" v-loading="loading" size="mini" :cell-style="changeCellStyle" :header-cell-style="changeHeaderCellStyle">
                <el-table-column label="加工单号" prop="processing_code" fixed width="140"></el-table-column>
                <el-table-column label="款号" prop="type_no" width="120" fixed></el-table-column>
                <el-table-column label="工厂合同号" prop="factory_contract_no" width="150" fixed></el-table-column>
                <el-table-column label="供应商" prop="factory_name" width="150" show-overflow-tooltip fixed></el-table-column>
                <el-table-column label="大货">
                    <el-table-column label="核价编码" prop="big_pricing_number" width="120">
                        <template slot-scope="{ row }">
                            <copy-link copy-class="copy-big_pricing_number" lind-to="soa_pricing_verify" :lind-value="row.big_pricing_number"></copy-link>
                        </template>
                    </el-table-column>
                    <el-table-column label="成本加价总价" prop="big_pricing_price" width="80"></el-table-column>
                    <el-table-column label="成衣成本加价总价" prop="process_pricing_price" width="80"></el-table-column>
                </el-table-column>
                <el-table-column label="实付">
                    <el-table-column label="核价编码" prop="pay_pricing_number" width="120">
                        <template slot-scope="{ row }" v-if="row.pay_pricing_number">
                            <copy-link copy-class="copy-pay_pricing_number" lind-to="soa_pricing_verify" :lind-value="row.pay_pricing_number"></copy-link>
                        </template>
                    </el-table-column>
                    <el-table-column label="成本加价总价" prop="pay_pricing_price" width="80"></el-table-column>
                    <el-table-column label="成衣成本加价总价" prop="pay_process_price" width="80"></el-table-column>
                </el-table-column>
                <el-table-column label="差价" prop="difference_price" width="80">
                    <template slot-scope="{ row }">
                        <div :style="{color: Number(row.difference_price) > 0 ? '#f56c6c' :(Number(row.difference_price) < 0 ? '#67C23A' : '#909399')}">
                            {{ row.difference_price }}
                        </div>
                    </template>
                </el-table-column>
                <el-table-column label="状态" align="center" prop="status" width="100">
                    <template slot-scope="{ row }">
                        <el-tag size="mini" type="info" v-if="row.status==0">未提交</el-tag>
                        <el-tag size="mini" type="primary" v-else-if="row.status==1">审核中</el-tag>
                        <el-tag size="mini" type="success" v-else-if="row.status==2">已通过</el-tag>
                        <el-tag size="mini" type="danger" v-else-if="row.status==3">已拒绝</el-tag>
                        <el-tag size="mini" type="info" v-else-if="row.status==4">已撤销</el-tag>
                        <el-tag size="mini" type="info" v-else-if="row.status==5">已撤回</el-tag>
                    </template>
                </el-table-column>
                <el-table-column label="历史价格变动(本次实付总价-首单实付总价)">
                    <el-table-column label="价格差" prop="pay_float" width="80">
                        <template slot-scope="{ row }">
                            <div v-if="row.pay_float_type == 0" style="color: #f56c6c">
                                {{ row.pay_float}}
                            </div>
                            <div v-else style="color: #67C23A">{{ row.pay_float }}</div>
                        </template>
                    </el-table-column>
                    <el-table-column label="价差比例" align="center" prop="pay_float_lv" width="80">
                        <template slot-scope="{ row }">
                            <div v-if="row.pay_float_lv == 0 || row.pay_float_lv == null">
                                -
                            </div>
                            <div v-else-if="row.pay_float_type == 0" style="color: #f56c6c">
                                {{(row.pay_float_lv * 100).toFixed(2)}}%
                                <i class="el-icon-top"></i>
                            </div>
                            <div v-else-if="row.pay_float_type == 1" style="color: #67c23a">
                                {{(row.pay_float_lv * 100).toFixed(2)}}%
                                <i class="el-icon-bottom"></i>
                            </div>
                        </template>
                    </el-table-column>
                </el-table-column>
                <el-table-column label="理单员" prop="order_processor" width="80" show-overflow-tooltip></el-table-column>
                <el-table-column label="提交时间" prop="addtime" width="135"></el-table-column>
                <el-table-column label="审核时间" prop="examinetime" width="135"></el-table-column>
                <el-table-column label="图片" prop="images" width="50">
                    <template scope="{ row }">
                        <el-image v-if="row.images && row.images.length>0" :src="row.images[0]" fit="contian" :preview-src-list="row.images"></el-image>
                    </template>
                </el-table-column>
                <el-table-column label="备注" prop="remarks" width="120" show-overflow-tooltip></el-table-column>
                <el-table-column label="原因" prop="reason" width="120" show-overflow-tooltip></el-table-column>
                <el-table-column label="操作" align="center" fixed="right" width="150">
                    <template slot-scope="{ row }">
                            <el-button type="text" size="mini" @click="editBtn(row)"
                                        :disabled="row.status == 1 ||row.status == 2">编辑</el-button>
                            <el-button type="text" size="mini" @click="submitBtn(row.id)"
                                       :disabled="row.status == 1 ||row.status == 2">提交</el-button>
                            <el-button :disabled="!row.run_id" type="text" size="mini" @click="approvalProcessBtn(row.id, row.run_id)">审批进度</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <!--翻页栏-->
            <div style="margin-top: 4px;overflow: hidden;float: right;">
                <Page :total="total" :current="page" :page-size="limit" show-total @on-change="pageChange"></Page>
            </div>
        </el-col>

        <!--调整实付核价-->
        <el-drawer title="调整实付核价单" :visible.sync="editVisible" size="1200px" direction="rtl" :wrapperClosable="false" :before-close="closeBtn">
            <el-row style="padding: 0 20px;overflow-y: auto" :style="{'height':drawerTableHeight2}">
                <div>
                    <svg t="1717659283335" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9445" width="16" height="16"><path d="M407.466667 477.866667h-277.333334C93.866667 477.866667 64 448 64 409.6v-277.333333c0-36.266667 29.866667-66.133333 66.133333-66.133334h277.333334c36.266667 0 66.133333 29.866667 66.133333 66.133334v277.333333c2.133333 38.4-27.733333 68.266667-66.133333 68.266667zM132.266667 108.8c-12.8 0-25.6 10.666667-25.6 25.6v277.333333c0 12.8 10.666667 25.6 25.6 25.6h277.333333c12.8 0 25.6-10.666667 25.6-25.6v-277.333333c0-12.8-10.666667-25.6-25.6-25.6h-277.333333zM407.466667 960h-277.333334C93.866667 960 64 930.133333 64 893.866667v-277.333334c0-36.266667 29.866667-66.133333 66.133333-66.133333h277.333334c36.266667 0 66.133333 29.866667 66.133333 66.133333v277.333334c2.133333 36.266667-27.733333 66.133333-66.133333 66.133333zM132.266667 590.933333c-12.8 0-25.6 10.666667-25.6 25.6v277.333334c0 12.8 10.666667 25.6 25.6 25.6h277.333333c12.8 0 25.6-10.666667 25.6-25.6v-277.333334c0-12.8-10.666667-25.6-25.6-25.6h-277.333333z m618.666666-110.933333c-17.066667 0-34.133333-6.4-46.933333-19.2L563.2 320c-12.8-12.8-19.2-29.866667-19.2-46.933333s6.4-34.133333 19.2-46.933334L704 83.2c12.8-12.8 29.866667-19.2 46.933333-19.2 17.066667 0 34.133333 6.4 46.933334 19.2l140.8 140.8c12.8 12.8 19.2 29.866667 19.2 46.933333 0 17.066667-6.4 34.133333-19.2 46.933334l-138.666667 142.933333c-12.8 12.8-29.866667 19.2-49.066667 19.2z m0-373.333333c-6.4 0-12.8 2.133333-17.066666 6.4l-140.8 140.8c-4.266667 4.266667-6.4 10.666667-6.4 17.066666 0 6.4 2.133333 12.8 6.4 17.066667l140.8 140.8c4.266667 4.266667 10.666667 6.4 17.066666 6.4 6.4 0 12.8-2.133333 17.066667-6.4l140.8-140.8c4.266667-4.266667 6.4-10.666667 6.4-17.066667 0-6.4-2.133333-12.8-6.4-17.066666L768 113.066667c-4.266667-4.266667-8.533333-6.4-17.066667-6.4z m138.666667 853.333333h-277.333333c-36.266667 0-66.133333-29.866667-66.133334-66.133333v-277.333334c0-36.266667 29.866667-66.133333 66.133334-66.133333h277.333333c36.266667 0 66.133333 29.866667 66.133333 66.133333v277.333334c2.133333 36.266667-27.733333 66.133333-66.133333 66.133333zM614.4 590.933333c-12.8 0-25.6 10.666667-25.6 25.6v277.333334c0 12.8 10.666667 25.6 25.6 25.6h277.333333c12.8 0 25.6-10.666667 25.6-25.6v-277.333334c0-12.8-10.666667-25.6-25.6-25.6h-277.333333z" fill="#1E87EB" p-id="9446"></path></svg>
                    <span style="font-size: 16px;font-weight: bold;vertical-align: bottom;margin-left: 4px;">实付核价单</span>
                </div>
                <el-table :data="priceOrders" style="width: 100%" size="mini" max-height="400px">
                    <el-table-column width="35">
                        <template slot-scope="{ row }">
                            <el-radio :label="row.number" v-model="pay_pricing_number">&nbsp;</el-radio>
                        </template>
                    </el-table-column>
                    <el-table-column label="核价单编码" prop="number" width="130"></el-table-column>
                    <el-table-column label="款号" prop="style_number" width="120"></el-table-column>
                    <el-table-column label="创建人" prop="creator" width="90"></el-table-column>
                    <el-table-column label="创建时间" prop="creation_time" width="135"></el-table-column>
                    <el-table-column label="核价用途" prop="t73_id" width="120">
                        <template slot-scope="{row}">
                            <el-tag size="mini" v-if="row.t73_id == 1" type="primary">大货核价</el-tag>
                            <el-tag size="mini" v-else-if="row.t73_id == 2" type="info">过审核价</el-tag>
                            <el-tag size="mini" v-else-if="row.t73_id == 3" type="warning">成本预估核价</el-tag>
                            <el-tag size="mini" v-else-if="row.t73_id == 4" type="success">实付核价</el-tag>
                        </template>
                    </el-table-column>
                    <el-table-column label="状态" prop="state" width="80">
                        <template slot-scope="{ row }">
                            <el-tag size="mini" v-if="row.state == 0" type="info">未锁定</el-tag>
                            <el-tag size="mini" v-else-if="row.state == 1" type="danger">锁定</el-tag>
                            <el-tag size="mini" v-else>{{row.state}}</el-tag>
                        </template>
                    </el-table-column>
                    <el-table-column label="成衣成本加价总价" prop="f65" width="120">
                        <template slot-scope="{row}">
                            {{parseFloat(row.f65)}}
                        </template>
                    </el-table-column>
                    <el-table-column label="绣花成本加价总价" prop="f63" width="120">
                        <template slot-scope="{row}">
                            {{parseFloat(row.f63)}}
                        </template>
                    </el-table-column>
                    <el-table-column label="成本加价总价" prop="f67" width="100">
                        <template slot-scope="{row}">
                            {{parseFloat(row.f67)}}
                        </template>
                    </el-table-column>
                    <el-table-column label="核价单备注" prop="comment" show-overflow-tooltip></el-table-column>
                </el-table>
                <div style="margin-top: 20px">
                    <svg t="1717659283335" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9445" width="16" height="16"><path d="M407.466667 477.866667h-277.333334C93.866667 477.866667 64 448 64 409.6v-277.333333c0-36.266667 29.866667-66.133333 66.133333-66.133334h277.333334c36.266667 0 66.133333 29.866667 66.133333 66.133334v277.333333c2.133333 38.4-27.733333 68.266667-66.133333 68.266667zM132.266667 108.8c-12.8 0-25.6 10.666667-25.6 25.6v277.333333c0 12.8 10.666667 25.6 25.6 25.6h277.333333c12.8 0 25.6-10.666667 25.6-25.6v-277.333333c0-12.8-10.666667-25.6-25.6-25.6h-277.333333zM407.466667 960h-277.333334C93.866667 960 64 930.133333 64 893.866667v-277.333334c0-36.266667 29.866667-66.133333 66.133333-66.133333h277.333334c36.266667 0 66.133333 29.866667 66.133333 66.133333v277.333334c2.133333 36.266667-27.733333 66.133333-66.133333 66.133333zM132.266667 590.933333c-12.8 0-25.6 10.666667-25.6 25.6v277.333334c0 12.8 10.666667 25.6 25.6 25.6h277.333333c12.8 0 25.6-10.666667 25.6-25.6v-277.333334c0-12.8-10.666667-25.6-25.6-25.6h-277.333333z m618.666666-110.933333c-17.066667 0-34.133333-6.4-46.933333-19.2L563.2 320c-12.8-12.8-19.2-29.866667-19.2-46.933333s6.4-34.133333 19.2-46.933334L704 83.2c12.8-12.8 29.866667-19.2 46.933333-19.2 17.066667 0 34.133333 6.4 46.933334 19.2l140.8 140.8c12.8 12.8 19.2 29.866667 19.2 46.933333 0 17.066667-6.4 34.133333-19.2 46.933334l-138.666667 142.933333c-12.8 12.8-29.866667 19.2-49.066667 19.2z m0-373.333333c-6.4 0-12.8 2.133333-17.066666 6.4l-140.8 140.8c-4.266667 4.266667-6.4 10.666667-6.4 17.066666 0 6.4 2.133333 12.8 6.4 17.066667l140.8 140.8c4.266667 4.266667 10.666667 6.4 17.066666 6.4 6.4 0 12.8-2.133333 17.066667-6.4l140.8-140.8c4.266667-4.266667 6.4-10.666667 6.4-17.066667 0-6.4-2.133333-12.8-6.4-17.066666L768 113.066667c-4.266667-4.266667-8.533333-6.4-17.066667-6.4z m138.666667 853.333333h-277.333333c-36.266667 0-66.133333-29.866667-66.133334-66.133333v-277.333334c0-36.266667 29.866667-66.133333 66.133334-66.133333h277.333333c36.266667 0 66.133333 29.866667 66.133333 66.133333v277.333334c2.133333 36.266667-27.733333 66.133333-66.133333 66.133333zM614.4 590.933333c-12.8 0-25.6 10.666667-25.6 25.6v277.333334c0 12.8 10.666667 25.6 25.6 25.6h277.333333c12.8 0 25.6-10.666667 25.6-25.6v-277.333334c0-12.8-10.666667-25.6-25.6-25.6h-277.333333z" fill="#1E87EB" p-id="9446"></path></svg>
                    <span style="font-size: 16px;font-weight: bold;vertical-align: bottom;margin-left: 4px;">调整原因</span>
                </div>
                <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4 }" v-model.trim="reason" placeholder="格式：物料名称+单位+部位+原价+现价+原因"></el-input>
                <div style="margin-top: 20px">
                    <svg t="1717659283335" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9445" width="16" height="16"><path d="M407.466667 477.866667h-277.333334C93.866667 477.866667 64 448 64 409.6v-277.333333c0-36.266667 29.866667-66.133333 66.133333-66.133334h277.333334c36.266667 0 66.133333 29.866667 66.133333 66.133334v277.333333c2.133333 38.4-27.733333 68.266667-66.133333 68.266667zM132.266667 108.8c-12.8 0-25.6 10.666667-25.6 25.6v277.333333c0 12.8 10.666667 25.6 25.6 25.6h277.333333c12.8 0 25.6-10.666667 25.6-25.6v-277.333333c0-12.8-10.666667-25.6-25.6-25.6h-277.333333zM407.466667 960h-277.333334C93.866667 960 64 930.133333 64 893.866667v-277.333334c0-36.266667 29.866667-66.133333 66.133333-66.133333h277.333334c36.266667 0 66.133333 29.866667 66.133333 66.133333v277.333334c2.133333 36.266667-27.733333 66.133333-66.133333 66.133333zM132.266667 590.933333c-12.8 0-25.6 10.666667-25.6 25.6v277.333334c0 12.8 10.666667 25.6 25.6 25.6h277.333333c12.8 0 25.6-10.666667 25.6-25.6v-277.333334c0-12.8-10.666667-25.6-25.6-25.6h-277.333333z m618.666666-110.933333c-17.066667 0-34.133333-6.4-46.933333-19.2L563.2 320c-12.8-12.8-19.2-29.866667-19.2-46.933333s6.4-34.133333 19.2-46.933334L704 83.2c12.8-12.8 29.866667-19.2 46.933333-19.2 17.066667 0 34.133333 6.4 46.933334 19.2l140.8 140.8c12.8 12.8 19.2 29.866667 19.2 46.933333 0 17.066667-6.4 34.133333-19.2 46.933334l-138.666667 142.933333c-12.8 12.8-29.866667 19.2-49.066667 19.2z m0-373.333333c-6.4 0-12.8 2.133333-17.066666 6.4l-140.8 140.8c-4.266667 4.266667-6.4 10.666667-6.4 17.066666 0 6.4 2.133333 12.8 6.4 17.066667l140.8 140.8c4.266667 4.266667 10.666667 6.4 17.066666 6.4 6.4 0 12.8-2.133333 17.066667-6.4l140.8-140.8c4.266667-4.266667 6.4-10.666667 6.4-17.066667 0-6.4-2.133333-12.8-6.4-17.066666L768 113.066667c-4.266667-4.266667-8.533333-6.4-17.066667-6.4z m138.666667 853.333333h-277.333333c-36.266667 0-66.133333-29.866667-66.133334-66.133333v-277.333334c0-36.266667 29.866667-66.133333 66.133334-66.133333h277.333333c36.266667 0 66.133333 29.866667 66.133333 66.133333v277.333334c2.133333 36.266667-27.733333 66.133333-66.133333 66.133333zM614.4 590.933333c-12.8 0-25.6 10.666667-25.6 25.6v277.333334c0 12.8 10.666667 25.6 25.6 25.6h277.333333c12.8 0 25.6-10.666667 25.6-25.6v-277.333334c0-12.8-10.666667-25.6-25.6-25.6h-277.333333z" fill="#1E87EB" p-id="9446"></path></svg>
                    <span style="font-size: 16px;font-weight: bold;vertical-align: bottom;margin-left: 4px;">截图说明</span>
                </div>
                <el-upload action="/api/tool/fileImport" list-type="picture-card"
                           :headers="uploadHeaders"
                           :data="uploadData"
                           :file-list="images"
                           :on-success="(res, file, fileList)=>uploadSuccessHandle(res, fileList)"
                           :before-upload="beforeUploadHandle">
                    <i slot="default" class="el-icon-plus"></i>
                    <div slot="file" slot-scope="{file}">
                        <img class="el-upload-list__item-thumbnail" :src="file.url" />
                        <span class="el-upload-list__item-actions">
<!--                        <span class="el-upload-list__item-preview" @click="previewImgBtn(file)">-->
<!--                          <i class="el-icon-zoom-in"></i>-->
<!--                        </span>-->
                        <span class="el-upload-list__item-delete" @click="delImgBtn(file)">
                          <i class="el-icon-delete"></i>
                        </span>
                    </span>
                    </div>
                </el-upload>
            </el-row>
            <div style="width: 100%;position: absolute;bottom: 10px;padding: 8px;border-top: 1px #ebeef5 solid;">
                <el-button @click="closeBtn">退 出</el-button>
                <el-button type="primary" @click="setPricingBtn" :loading="saveLoading" :disabled="!pay_pricing_number">{{ saveLoading ? '提交中 ...' : '确 定' }}</el-button>
            </div>
        </el-drawer>

        <!--审核进度-->
        <el-drawer title="核价单变动审批" :visible.sync="approvalVisible" size="650px" direction="rtl" :wrapperClosable="false" :before-close="closeBtn">
            <processPriceExamine v-if="approvalVisible" :runId="runId" :id="pricingExamineId"></processPriceExamine>
        </el-drawer>
    </section>
</template>

<script>

import {factoryList} from "../../../api/produce/factory";
import {priceOrderCheckList, priceOrderSetPricingExamine, priceOrderSubmit} from "../../../api/soa/pricing";
import {getToken} from "../../../libs/util";
import processPriceExamine from "../../../view/components/flow/processPriceExamine";
import CopyLink from "../../components/copyLink";
import {verifyPriceList} from "../../../api/soa/verify";

export default {
    name: "soa_pricing_check",
    components:{CopyLink, processPriceExamine},
    data() {
        return {
            tableHeight: window.innerHeight - 210,
            selectIndex: 0,
            btnLoading: false,
            loading: false,
            page: 1,
            limit: 20,
            total: 0,
            data: [],
            user: {},
            nodeActions: [],

            form: {supplier_id:"",processing_code:"", type_no: "", status: ""},
            searchLoading: false,
            factoryList: [],

            detail: {},
            detailVisible: false,
            editVisible: false,
            drawerTableHeight: window.innerHeight - 85+"px",
            drawerTableHeight2: window.innerHeight - 150+"px",
            priceOrders: [],
            reason: "",//实付调整原因
            images: [],//调整截图说明
            pricingExamineId: "",//审核核价单id
            pay_pricing_number: "",//实付核价编码
            saveLoading: false,

            uploadHeaders: {},
            uploadData:{type: 'soa_pricing_check', disk: 'image'},

            approvalVisible: false,
            runId: ""
        }
    },
    watch:{
        // 监听路由参数的变化
        '$route.params.processing_code': {
            immediate: true,
            handler(val) {
                if(!!val && val != this.form.processing_code){
                    this.$set(this.form, 'processing_code', val);
                    this.searchBtn();
                }
            }
        },
    },
    created() {
        this.user = this.$store.getters.user;
        this.nodeActions = this.user.node_actions[this.$route.meta.id] ? this.user.node_actions[this.$route.meta.id] : [];
    },
    methods: {
        //搜索按钮
        searchBtn() {
            this.page = 1;
            this.getData();
        },
        //翻页
        pageChange(page) {
            this.page = page;
            this.getData();
        },
        //获取数据
        getData() {
            let param = {
                page: this.page,
                limit: this.limit
            };
            param = Object.assign(param, this.form);
            this.loading = true;
            priceOrderCheckList(param).then((res) => {
                this.loading = false;
                this.total = res.data.total;
                this.data = res.data.data;
            }).catch(() => {
                this.loading = false;
            });
        },
        searchFactoryBtn(val){
            if(val == ""){
                return;
            }
            this.getFactoryData(val);
        },
        getFactoryData(name){
            factoryList({page: 1, limit: 20, factory_name: name, status: 0}).then((res) =>{
                this.factoryList = res.data.data;
            })
        },
        changeCellStyle(row, column, rowIndex, columnIndex) {
            if (["big_pricing_number","big_pricing_price","process_pricing_price"].includes(row.column.property)) {
                return "background:#F5FBFF"; //修改的样式
            } else if (["pay_pricing_number","pay_pricing_price","pay_process_price"].includes(row.column.property)) {
                return "background:#FDFDF9";
            } else if (["pay_float","pay_float_lv"].includes(row.column.property)) {
                return "background:#F9FFFA";
            }
        },
        changeHeaderCellStyle(row, column, rowIndex, columnIndex) {
            if (["big_pricing_number","big_pricing_price","process_pricing_price"].includes(row.column.property) || row.column.label == "大货") {
                return "background:#F5FBFF"; //修改的样式
            } else if (["pay_pricing_number","pay_pricing_price","pay_process_price"].includes(row.column.property) || row.column.label == "实付") {
                return "background:#FDFDF9";
            } else if (["pay_float","pay_float_lv"].includes(row.column.property) || row.column.label == "历史价格变动(本次实付总价-首单实付总价)") {
                return "background:#F9FFFA";
            }
        },
        closeBtn(){
            this.pricingExamineId = "";
            this.images = [];
            this.pay_pricing_number = "";
            this.reason = "";
            this.runId = "";
            this.editVisible = false;
            this.approvalVisible = false;
        },
        //编辑实付核价单
        editBtn(row){
            this.images = [];
            if(row.images.length>0){
                row.images.forEach(url =>{
                    this.images.push({url: url});
                })
            }
            this.reason = row.reason;
            this.pricingExamineId = row.id;
            this.loading = true;
            verifyPriceList({page: 1, limit: 100, type_no: row.type_no, t73_id: 4, state: 1}).then((res) => {
                this.loading = false;
                this.priceOrders = res.data.data;
                this.editVisible = true;
            }).catch(()=>{
                this.loading = false;
            })
        },
        //设置实付核价
        setPricingBtn(){
            let obj = {
                id: this.pricingExamineId,
                images: [],
                pay_pricing_number: this.pay_pricing_number,
                reason: this.reason
            };
            this.images.forEach(item=>{
                obj.images.push({url: item.response && item.response.data ? item.response.data : item.url});
            });
            this.saveLoading = true;
            priceOrderSetPricingExamine(obj).then((res) =>{
                this.saveLoading = false;
                if(res.code === 0){
                    this.$message.success("设置成功");
                    this.closeBtn();
                    this.getData();
                }else{
                    this.$message.error(res.msg);
                }
            }).catch(()=>{
                this.saveLoading = false;
            })
        },
        //查看审核进度
        approvalProcessBtn(id, runId){
            this.runId = runId;
            this.pricingExamineId = id;
            this.approvalVisible = true;
        },
        //提交
        submitBtn(id){
            this.$confirm("提交该加工单核价审核, 是否确定？", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
            }).then(() => {
                this.loading = true;
                priceOrderSubmit({id: id}).then((res) =>{
                    this.loading = false;
                    if(res.code === 0){
                        this.$message.success(res.msg);
                        this.getData();
                    }else{
                        this.$message.error(res.msg);
                    }
                }).catch(()=>{
                    this.loading = false;
                })
            }).catch(() => {

            });
        },

        //删除图片
        delImgBtn(file){
            let index;
            for(let i in this.images){
                if(this.images[i].uid == file.uid){
                    index = i;
                    break;
                }
            }
            if(index != undefined){
                this.images.splice(index, 1);
            }
        },
        //上传之前的检测
        beforeUploadHandle(file) {
            if(!['image/jpg','image/jpeg','image/png'].includes(file.type)){
                this.$message.error('上传图片只能是 jpg、png 格式!');
                return false;
            }
            this.uploadHeaders.Authorization = 'Bearer '+ getToken();
            return true;
        },
        //上传成功
        uploadSuccessHandle(res, fileList) {
            if(res.code === 0){
                this.images = fileList
            }else{
                this.$message.error(res.msg);
                fileList = fileList.filter(item => item.response && item.response.code === 0);
                this.images = fileList;
            }
        },
    },
    mounted() {
        this.getFactoryData("");
        this.searchBtn();
    }
}
</script>

<style scoped>

</style>
